<?php
defined('SYS_RUN') or exit();

include_once 'class.Response.inc.php';

class RHttp extends Response {

    public function send() {
        $result = array(
            'status'  => $this->_status,
            'message' => $this->_message
        );

        if (!is_null($this->_data))
            $result['data'] = $this->_data;

        ob_clean();
        header('Content-Type: application/json');
        echo Lib::get('json')->encode($result);

        Sys::end();
    }

    public function getResponse() {
        return array(
            'status'  => $this->_status,
            'message' => $this->_message
        );
    }
}